
<%@page import="net.sf.jasperreports.engine.JasperRunManager"%>
<%@page import="java.util.Map"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.io.File"%>
<%@page import="net.sf.jasperreports.engine.JRException"%>
<%@page import="net.sf.jasperreports.engine.JasperFillManager"%>
<%@page import="net.sf.jasperreports.engine.JasperPrint"%>
<%@page import="net.sf.jasperreports.view.JasperViewer"%>

<%@ page pageEncoding="UTF-8" %>
<html>
    <head>
        <title>تقارير</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta name="description" content="" />
        <meta name="keywords" content="" />
        <!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
        <script src="js/jquery.min.js"></script>
        <script src="js/jquery.dropotron.min.js"></script>
        <script src="js/skel.min.js"></script>
        <script src="js/skel-layers.min.js"></script>
        <script src="js/init.js"></script>
        <noscript>
        <link rel="stylesheet" href="css/skel.css" />
        <link rel="stylesheet" href="css/style.css" />
        <link rel="stylesheet" href="css/style-desktop.css" />
        </noscript>
        <!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]-->
        <!--[if lte IE 9]><link rel="stylesheet" href="css/ie/v9.css" /><![endif]-->
    </head>
    <body class="no-sidebar">

        <!-- Header Wrapper -->
        <div id="header-wrapper">
            <div class="container">

                <!-- Header -->
                <header id="header">
                    <div class="inner">

                        <!-- Logo -->
                        <h1><a href="index.jsp" id="logo">الهيئة العامة للاستشعار عن بعد</a></h1>

                        <!-- Nav -->
                        <nav id="nav">
                            <ul>
                                <li class="current_page_item"><a href="index.jsp">الرئيسية</a></li>
                                <li>
                                    <a href="">تقييم أنشطة</a>
                                    <ul>
                                        <li><a href="report.jsp">مشاريع1</a></li>
                                        <li><a href="#"> مشاريع 2</a></li>
                                        <li>
                                            <a href=""> مشاريع</a>
                                            <ul>
                                                <li><a href="#"> مشاريع </a></li>
                                                <li><a href="#">مشاريع</a></li>
                                                <li><a href="#">مشاريع</a></li>
                                                <li><a href="#">مشاريع</a></li>
                                            </ul>
                                        </li>
                                        <li><a href="#">مشاريع 3</a></li>
                                    </ul>
                                </li>
                                <li><a href="left-sidebar.html">تقييم عاملين</a></li>
                                <li><a href="right-sidebar.html">تقييم أقسام</a></li>
                                <li><a href="no-sidebar.html">تقييم مشاريع</a></li>
                            </ul>
                        </nav>

                    </div>
                </header>
                <%

                Class.forName("org.postgresql.Driver");
            Connection conn = null;
            String userName = "neo";
            String password = "ne0_m07nf";
    // static String dbname = "NEO_MOEN";
            // static String serverip = "192.168.2.129";
            // static String serverip = "192.168.10.10";
            String dbname = "jsptest";
            //static String serverip = "127.0.0.1";
            String serverip = "127.0.0.1";
            String port = "5432";
            PreparedStatement preparedStatement;

            String firstName = request.getParameter("first");
            String lastName = request.getParameter("last");
            String gender = request.getParameter("gender");
            String email = request.getParameter("email");
            String dob = request.getParameter("birth");
            conn = DriverManager.getConnection(
                    "jdbc:postgresql://" + serverip + ":" + port + "/" + dbname + "?useUnicode=true&characterEncoding=UTF-8", userName,
                    password);
                     String path = getServletContext().getRealPath("/");
                   String fileName = path + "\\reports\\report1.jasper";

                    
                  File reportFile = new File(fileName);//your report_name.jasper file
            Map parameters = new HashMap();
            byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), parameters, conn);
 
            response.setContentType("application/pdf");
            response.setContentLength(bytes.length);
            ServletOutputStream outStream = response.getOutputStream();
            outStream.write(bytes, 0, bytes.length);
            outStream.flush();
            outStream.close();

                %>

            </div>
        </div>




        <!-- Footer Wrapper -->

    </body>
</html>